package com.hotel.product.controller;


import com.hotel.product.service.PurchaseService;
import com.hotel.user.entity.Product;
import com.hotel.user.entity.Purchase;
import com.hotel.user.entity.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author KK
 * @since 2024-06-18
 */
@RestController
@RequestMapping("/api/purchase")
public class PurchaseController {
    @Autowired
    private PurchaseService purchaseService;

    @PostMapping("/consumption")
    public ResponseDTO<String> purchaseProduct(@RequestBody Purchase purchase, HttpServletRequest request) {
      return   purchaseService.purchaseProduct(purchase,request);
//        return new ResponseDTO<>(200, "Purchase successful", null);
    }
}
